Fixed bug in maxwellrawio.py that shuffled channels #1310
Merged
apdavison merged 3 commits intoNeuralEnsemble:masterfrom Jul 27, 2023
hornauerp:master
Merged
Fixed bug in maxwellrawio.py that shuffled channels #1310apdavison merged 3 commits intoNeuralEnsemble:masterfrom hornauerp:master
apdavison merged 3 commits intoNeuralEnsemble:masterfrom
hornauerp:master
Conversation
Fix for issue SpikeInterface/spikeinterface#1691 that reshuffled channels when selecting and concatenating channels from MaxWell recordings.
Fixed bug in maxwellrawio.py that shuffled channels
Contributor
|
Thank you for the patch. @alejoe91 : can you check this ? |
Contributor
|
Thanks @hornauerp! Could you add a plot with the behavior before and after the fix? :) |
alejoe91
reviewed
Jul 24, 2023
neo/rawio/maxwellrawio.py
Outdated
Comment on lines
186
to
188
| sorted_channel_indexes = np.sort(channel_indexes) | ||
| resorted_indexes = np.array( | ||
| [list(channel_indexes).index(ch) for ch in sorted_channel_indexes]) | ||
| [list(sorted_channel_indexes).index(ch) for ch in channel_indexes]) |
Contributor
There was a problem hiding this comment.
@hornauerp I think there is a better implementation.
Can you try if this gives the same result:
order_f = np.argsort(channel_indexes)
sorted_channel_idxeses = channel_indexes[order_f]
# use argsort again on order_f to obtain resorted_indexes
resorted_indexes = np.argsort(order_f)
Contributor
Author
There was a problem hiding this comment.
Yes, same outcome, but slightly faster. (17 vs 50 us)
I just wanted to stick to the original code as much as possible to facilitate the review process, but yours is definitely the more optimal implementation.
Contributor
There was a problem hiding this comment.
Great, can you use the second implementation then?
Let's refresh the code ;)
Contributor
Author
alejoe91
approved these changes
Jul 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fix for issue https://github.com/SpikeInterface/spikeinterface/issues/1691 that shuffled channels when selecting and concatenating channels from MaxWell recordings with different mappings.